import cv2

def cv_show(name,img):
    cv2.imshow(name,img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

image = cv2.imread("D:\\data\\real\\IMG_5470.JPG")

img_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imwrite('Gray.jpg', img_gray)
cv_show("Gray",img_gray)

img_b,img_g,img_r=cv2.split(image)
#cv2.imwrite('b_img.jpg', img_b)
#img_m = cv2.gerge((b,g,r))
image_copy = image.copy()
image_copy[:,:,0] = 0
image_copy[:,:,1] = 0
cv2.imwrite('R.jpg', image_copy)

image_copy = image.copy()
image_copy[:,:,1] = 0
image_copy[:,:,2] = 0
cv2.imwrite('B.jpg', image_copy)

image_copy = image.copy()
image_copy[:,:,0] = 0
image_copy[:,:,2] = 0
cv2.imwrite('G.jpg', image_copy)